<?php

declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class BizGoodsTableMigration extends AbstractMigration
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change(): void
    {
        $this->table('biz_goods')
        ->addColumn('city_id', 'integer', ['null' => true,'limit'=>11,'default'=>0,'comment'=>'城市id'])
        ->addColumn('biz_id', 'integer', ['null' => true,'limit'=>11,'default'=>0,'comment'=>'商家id'])
        ->addColumn('title', 'string', ['null' => true,'limit'=>100,'comment'=>'商品名称'])
        ->addColumn('image', 'string', ['null' => true,'comment'=>'商品图片'])
        ->addColumn('price', 'decimal', ['null' => true,'comment'=>'商品价格','precision'=>10,'scale'=>2])
        ->addColumn('status', 'integer', ['null' => true,'limit'=>1,'default'=>0,'comment'=>'商品状态0-下架 1-上架'])
        ->addColumn('created_at', 'integer', ['null' => true,'comment'=>'创建时间'])
        ->addColumn('updated_at', 'integer', ['null' => true,'comment'=>'更新时间'])
        ->addColumn('deleted_at', 'integer', ['null' => true,'comment'=>'删除时间'])
        ->create();
    }
}
